import React from "react";
import Slider from "react-slick";
export default class VendingMachineHome extends React.Component<any, any> {
  constructor(props) {
    super(props);
    this.state = {};
  }
  static displayName = "VendingMachine";

  static defaultProps = {};
  componentDidMount() {}
  render() {
    const { homePage } = this.props;
    const data = homePage.toJS().homeImage.map((item, index) => {
      return (
        <div key={index}>
          <img src={item.imgSrc} style={{ width: "100%", height: "640px" }} />
        </div>
      );
    });
    const settings = {
      dots: false,
      infinite: homePage.get("homeImage").size === 1 ? false : true,
      autoplay: true,
      speed: 500,
      slidesToShow: 1,
      slidesToScroll: 1
    };
    return (
      <div className="vending-machine-home">
        <div className="vending-machine-banner">
          <Slider {...settings}>{data}</Slider>
        </div>
      </div>
    );
  }
}
